home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / shells / bashsrc.zoo / src / bash-dif.st next >
Encoding:
Text File  |  1991-06-08  |  15.4 KB  |  581 lines

  1. diff -c orig/bashline.c ./bashline.c
  2. *** orig/bashline.c    Wed Jun  5 19:30:06 1991
  3. --- ./bashline.c    Wed Jun  5 19:32:48 1991
  4. ***************
  5. *** 19,25 ****
  6.   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  7.   
  8.   #include <stdio.h>
  9. ! #include <readline/readline.h>
  10.   #include "config.h"
  11.   #include "general.h"
  12.   #include "variables.h"
  13. --- 19,25 ----
  14.   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  15.   
  16.   #include <stdio.h>
  17. ! #include "readline/readline.h"
  18.   #include "config.h"
  19.   #include "general.h"
  20.   #include "variables.h"
  21. diff -c orig/builtins.c ./builtins.c
  22. *** orig/builtins.c    Wed Jun  5 19:30:24 1991
  23. --- ./builtins.c    Fri Jun  7 19:54:34 1991
  24. ***************
  25. *** 212,225 ****
  26.       printed" },
  27.   
  28.     { "history", history_builtin, 1, "history [n] [-s] [ [-w | -r] [filename]]",
  29.         "    Display the history list with line numbers.  Lines listed with\n\
  30.       with a `*' have been modified.  Argument of N says to list only\n\
  31.       the last N lines.  Argument `-w' means write out the current\n\
  32.       history file.  `-r' means to read it instead.  If FILENAME is\n\
  33.       given, then use that file, else if $HISTFILE has a value, use\n\
  34.       that, else use ~/.bash_history.  Argument -s oerforms history\n\
  35.       substitution on the following args" },
  36.   #ifdef JOB_CONTROL
  37.     { "jobs", jobs_builtin, 1, "jobs [-l]",
  38.         "    Lists the active jobs; given the -l options lists process id's\n\
  39. --- 212,234 ----
  40.       printed" },
  41.   
  42.     { "history", history_builtin, 1, "history [n] [-s] [ [-w | -r] [filename]]",
  43. + #ifdef MiNT
  44.         "    Display the history list with line numbers.  Lines listed with\n\
  45.       with a `*' have been modified.  Argument of N says to list only\n\
  46.       the last N lines.  Argument `-w' means write out the current\n\
  47.       history file.  `-r' means to read it instead.  If FILENAME is\n\
  48.       given, then use that file, else if $HISTFILE has a value, use\n\
  49. +     that, else use ~/bash_his.  Argument -s oerforms history\n\
  50. +     substitution on the following args" },
  51. + #else
  52. +       "    Display the history list with line numbers.  Lines listed with\n\
  53. +     with a `*' have been modified.  Argument of N says to list only\n\
  54. +     the last N lines.  Argument `-w' means write out the current\n\
  55. +     history file.  `-r' means to read it instead.  If FILENAME is\n\
  56. +     given, then use that file, else if $HISTFILE has a value, use\n\
  57.       that, else use ~/.bash_history.  Argument -s oerforms history\n\
  58.       substitution on the following args" },
  59. ! #endif
  60.   #ifdef JOB_CONTROL
  61.     { "jobs", jobs_builtin, 1, "jobs [-l]",
  62.         "    Lists the active jobs; given the -l options lists process id's\n\
  63. ***************
  64. *** 725,730 ****
  65. --- 734,750 ----
  66.     char *orig_string = string;
  67.     extern COMMAND *global_command;
  68.   
  69. + #ifdef MiNT /* we want to convert excess \r's to spaces */
  70. +   {
  71. +     char *s = string;
  72. +     while (*s) {
  73. +       if(*s == '\r')
  74. +         *s = ' ';
  75. +       ++s;
  76. +     }
  77. +   }
  78. + #endif
  79.     push_stream ();
  80.     interactive = 0;
  81.     indirection_level++;
  82. ***************
  83. *** 1699,1729 ****
  84.   
  85.       return (result ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
  86.         }
  87. !     }
  88. !   if (strcmp (list->word->word, "-s") == 0)
  89. !     {
  90. !       extern int history_expand ();
  91. !       char *expanded;
  92. !       int rval;
  93.   
  94. !       list = list->next;
  95.   
  96. !       while (list)
  97. !     {
  98. !       rval = history_expand (list->word->word, &expanded);
  99. !       printf ("%s", expanded);
  100. !       fflush (stdout);
  101.   
  102. !       if (rval == -1)
  103. !         return (EXECUTION_FAILURE);
  104.   
  105. !       free (expanded);
  106.   
  107. !       list = list->next;
  108. !     }
  109.       }
  110. !   
  111.     limit = get_numeric_arg (list);
  112.     if (limit < 0)
  113.       limit = -limit;
  114. --- 1719,1749 ----
  115.   
  116.       return (result ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
  117.         }
  118. ! /* (Was this a bug??? It appears so. Oh well, it's fixed now.) */
  119. !       if (strcmp (list->word->word, "-s") == 0) 
  120. !     {
  121. !           extern int history_expand ();
  122. !           char *expanded;
  123. !           int rval;
  124.   
  125. !           list = list->next;
  126.   
  127. !           while (list)
  128. !         {
  129. !           rval = history_expand (list->word->word, &expanded);
  130. !           printf ("%s", expanded);
  131. !           fflush (stdout);
  132.   
  133. !           if (rval == -1)
  134. !             return (EXECUTION_FAILURE);
  135.   
  136. !           free (expanded);
  137.   
  138. !           list = list->next;
  139. !         }
  140. !         }
  141.       }
  142.     limit = get_numeric_arg (list);
  143.     if (limit < 0)
  144.       limit = -limit;
  145. ***************
  146. *** 2195,2201 ****
  147. --- 2215,2225 ----
  148.   scale60 (tvalp)
  149.        struct timeval *tvalp;
  150.   {
  151. + # ifdef MiNT /* I don't know what's going on here, so I'll do it myself. */
  152. +   return tvalp->tv_sec;
  153. + # else
  154.     return (tvalp->tv_sec * 60 + tvalp->tv_usec / 16667);
  155. + # endif /* MiNT */
  156.   }
  157.   #endif /* !SYSV */
  158.   
  159. ***************
  160. *** 2210,2222 ****
  161.     no_args (list);
  162.   
  163.     getrusage (RUSAGE_SELF, &self);
  164. !   getrusage (RUSAGE_CHILDREN, &kids);    /* terminated child processes */
  165.   
  166.     user_seconds_used = scale60(&self.ru_utime) + scale60(&kids.ru_utime);
  167.     system_seconds_used = scale60(&self.ru_stime) + scale60(&kids.ru_stime);
  168.   
  169.   #else /* SYSV */
  170.   #ifndef HZ
  171.   #define HZ 100        /* From my Sys V.3.2 manual for times(2) */
  172.   #endif /* !HZ */
  173. --- 2234,2245 ----
  174.     no_args (list);
  175.   
  176.     getrusage (RUSAGE_SELF, &self);
  177. !   getrusage (RUSAGE_CHILDREN, &kids); /* terminated child processes */
  178.   
  179.     user_seconds_used = scale60(&self.ru_utime) + scale60(&kids.ru_utime);
  180.     system_seconds_used = scale60(&self.ru_stime) + scale60(&kids.ru_stime);
  181.   
  182.   #else /* SYSV */
  183.   #ifndef HZ
  184.   #define HZ 100        /* From my Sys V.3.2 manual for times(2) */
  185.   #endif /* !HZ */
  186. diff -c orig/config.h ./config.h
  187. *** orig/config.h    Wed Jun  5 19:39:52 1991
  188. --- ./config.h    Wed Jun  5 19:39:30 1991
  189. ***************
  190. *** 52,59 ****
  191. --- 52,64 ----
  192.   #define READLINE
  193.   
  194.   /* The default value of the PATH variable. */
  195. + #ifdef MiNT
  196.   #define DEFAULT_PATH_VALUE \
  197. +     ",/dev/c/bin,/dev/d/bin"
  198. + #else
  199. + #define DEFAULT_PATH_VALUE \
  200.       ":/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/etc:/usr/etc"
  201. + #endif
  202.   
  203.   /* Define V9_ECHO if you want to give the echo builtin backslash-escape
  204.      interpretation, in the style of the Bell Labs 9th Edition version of
  205. diff -c orig/execute_.c ./execute_.c
  206. *** orig/execute_.c    Wed Jun  5 19:30:38 1991
  207. --- ./execute_.c    Wed Jun  5 19:33:18 1991
  208. ***************
  209. *** 35,41 ****
  210. --- 35,45 ----
  211.   #include <errno.h>
  212.   
  213.   #include "shell.h"
  214. + #ifdef MiNT
  215. + #include "parse-t.h"
  216. + #else
  217.   #include "y.tab.h"
  218. + #endif
  219.   #include "builtins.h"
  220.   #include "flags.h"
  221.   #include "hash.h"
  222. ***************
  223. *** 877,883 ****
  224. --- 881,891 ----
  225.             struct stat finfo;
  226.             extern int errno;
  227.   
  228. + #ifdef MiNT
  229. +           if (!executable_file(args[0]))
  230. + #else
  231.             if (errno != ENOEXEC)
  232. + #endif
  233.               {
  234.                 if ((stat (command, &finfo) == 0) &&
  235.                 ((finfo.st_mode & S_IFMT) == S_IFDIR))
  236. ***************
  237. *** 1381,1397 ****
  238.   }
  239.   
  240.   #ifndef SYSV
  241.   /* The number of groups (within 64) that this user is a member of. */
  242.   static int default_group_array_size = 0;
  243.   static int ngroups = 0;
  244.   static int *group_array = (int *)NULL;
  245.   #endif
  246.   
  247.   /* Return non-zero if GID is one that we have in our groups list. */
  248.   group_member (gid)
  249.        int gid;
  250.   {
  251. ! #ifdef SYSV
  252.     return ((gid == getgid ()) || (gid == geteuid ()));
  253.   #else
  254.   
  255. --- 1389,1407 ----
  256.   }
  257.   
  258.   #ifndef SYSV
  259. + #ifndef MiNT
  260.   /* The number of groups (within 64) that this user is a member of. */
  261.   static int default_group_array_size = 0;
  262.   static int ngroups = 0;
  263.   static int *group_array = (int *)NULL;
  264.   #endif
  265. + #endif
  266.   
  267.   /* Return non-zero if GID is one that we have in our groups list. */
  268.   group_member (gid)
  269.        int gid;
  270.   {
  271. ! #if defined(SYSV) || defined(MiNT)
  272.     return ((gid == getgid ()) || (gid == geteuid ()));
  273.   #else
  274.   
  275. ***************
  276. *** 1556,1561 ****
  277. --- 1566,1580 ----
  278.        char *path_list;
  279.        int must_be_executable;
  280.   {
  281. + #ifdef MiNT
  282. +   static char *extensions[] = {"ttp", "prg", "tos", "sh", 0};
  283. +   extern char *findfile();
  284. +   char *foo;
  285. +   foo = findfile(name, path_list, extensions);
  286. +   if (!foo) return foo;
  287. +   return savestring(foo);
  288. + #else
  289.     extern char *extract_colon_unit ();
  290.     extern int file_exists_p;
  291.     char *full_path;
  292. ***************
  293. *** 1635,1640 ****
  294. --- 1654,1660 ----
  295.       return (file_to_lose_on);
  296.     else
  297.       return (char *)NULL;
  298. + #endif
  299.   }
  300.   
  301.   /* Given a string containing units of information separated by colons,
  302. ***************
  303. *** 1652,1664 ****
  304.     if ((i >= strlen (string)) || !string)
  305.       return ((char *)NULL);
  306.   
  307.     if (string[i] == ':')
  308.       i++;
  309.   
  310.     start = i;
  311.   
  312.     while (string[i] && string[i] != ':') i++;
  313.     *index = i;
  314.   
  315.     if (i == start)
  316. --- 1672,1691 ----
  317.     if ((i >= strlen (string)) || !string)
  318.       return ((char *)NULL);
  319.   
  320. + #ifdef MiNT
  321. +   if (string[i] == ',')
  322. + #else
  323.     if (string[i] == ':')
  324. + #endif
  325.       i++;
  326.   
  327.     start = i;
  328.   
  329. + #ifdef MiNT
  330. +   while (string[i] && string[i] != ',') i++;
  331. + #else
  332.     while (string[i] && string[i] != ':') i++;
  333. ! #endif
  334.     *index = i;
  335.   
  336.     if (i == start)
  337. diff -c orig/general.h ./general.h
  338. *** orig/general.h    Wed Jun  5 19:39:54 1991
  339. --- ./general.h    Wed Jun  5 19:39:32 1991
  340. ***************
  341. *** 39,45 ****
  342.   #endif
  343.   
  344.   /* The output of `signal' is different on different systems.  Yechh. */
  345. ! #if defined(SunOS4) || defined (NeXT) || defined (Ultrix)
  346.   #define sighandler void
  347.   #else
  348.   #define sighandler int
  349. --- 39,45 ----
  350.   #endif
  351.   
  352.   /* The output of `signal' is different on different systems.  Yechh. */
  353. ! #if defined(SunOS4) || defined (NeXT) || defined (Ultrix) || defined(atarist)
  354.   #define sighandler void
  355.   #else
  356.   #define sighandler int
  357. diff -c orig/parse.y ./parse.y
  358. *** orig/parse.y    Wed May 29 12:23:52 1991
  359. --- ./parse.y    Wed Jun  5 16:28:32 1991
  360. ***************
  361. *** 98,104 ****
  362.                 eof_encountered = 0;
  363.                 discard_parser_constructs (1);
  364.                 if (interactive)
  365. !                 YYACCEPT
  366.                 else
  367.                   YYABORT;
  368.               }
  369. --- 98,104 ----
  370.                 eof_encountered = 0;
  371.                 discard_parser_constructs (1);
  372.                 if (interactive)
  373. !                 YYACCEPT;
  374.                 else
  375.                   YYABORT;
  376.               }
  377. diff -c orig/print_cm.c ./print_cm.c
  378. *** orig/print_cm.c    Wed Jun  5 19:31:10 1991
  379. --- ./print_cm.c    Wed Jun  5 19:34:04 1991
  380. ***************
  381. *** 25,31 ****
  382. --- 25,35 ----
  383.   #endif
  384.   
  385.   #include "shell.h"
  386. + #ifdef MiNT
  387. + #include "parse-t.h"
  388. + #else
  389.   #include "y.tab.h"
  390. + #endif
  391.   
  392.   static int indentation = 0;
  393.   static int indentation_amount = 4;
  394. diff -c orig/shell.c ./shell.c
  395. *** orig/shell.c    Wed Jun  5 19:31:14 1991
  396. --- ./shell.c    Fri Jun  7 13:03:30 1991
  397. ***************
  398. *** 49,54 ****
  399. --- 49,58 ----
  400.   #include <varargs.h>
  401.   #endif
  402.   
  403. + #ifdef atarist
  404. + long _stksize = 32*1024L;
  405. + #endif
  406.   #include "shell.h"
  407.   #include "flags.h"
  408.   
  409. ***************
  410. *** 140,146 ****
  411. --- 144,154 ----
  412.   char *shell_name;
  413.   
  414.   /* The name of the .(shell)rc file. */
  415. + #ifdef MiNT
  416. + char *bashrc_file = "~/bash.rc";
  417. + #else
  418.   char *bashrc_file = "~/.bashrc";
  419. + #endif
  420.   
  421.   /* Non-zero means to act more like the Bourne shell on startup. */
  422.   int act_like_sh = 0;
  423. ***************
  424. *** 368,373 ****
  425. --- 376,391 ----
  426.         /* If we are doing the .bash_profile, then don't do the .bashrc. */
  427.         no_rc++;
  428.   
  429. + #ifdef MiNT
  430. +       if (act_like_sh)
  431. +          maybe_execute_file ("~/profile");
  432. +       else
  433. +         {
  434. +           if (maybe_execute_file ("~/bash_profile") == 0)
  435. +         if (maybe_execute_file ("~/bash_login") == 0)
  436. +           maybe_execute_file ("~/profile");
  437. +         }
  438. + #else
  439.         if (act_like_sh)
  440.           maybe_execute_file ("~/.profile");
  441.         else
  442. ***************
  443. *** 376,382 ****
  444.           if (maybe_execute_file ("~/.bash_login") == 0)
  445.             maybe_execute_file ("~/.profile");
  446.           }
  447.         /* I turn on the restrictions afterwards because it is explictly
  448.            stated in the POSIX spec that PATH cannot be set in a restricted
  449.            shell, except in .profile. */
  450. --- 394,400 ----
  451.           if (maybe_execute_file ("~/.bash_login") == 0)
  452.             maybe_execute_file ("~/.profile");
  453.           }
  454. ! #endif
  455.         /* I turn on the restrictions afterwards because it is explictly
  456.            stated in the POSIX spec that PATH cannot be set in a restricted
  457.            shell, except in .profile. */
  458. ***************
  459. *** 704,710 ****
  460. --- 722,732 ----
  461.     initialize_signals ();
  462.     initialize_traps ();
  463.   
  464. +   initialize_shell_variables (shell_environment);
  465.     /* Initialize current_user_name and current_host_name. */
  466. +   /* dpg moved this here because currently gethostname on the ST calls
  467. +     getenv which is not the same in BASH as the library routine */
  468.     {
  469.       struct passwd *entry = getpwuid (getuid ());
  470.       char hostname[256];
  471. ***************
  472. *** 720,726 ****
  473.         current_user_name = savestring ("I have no name!");
  474.     }
  475.   
  476. -   initialize_shell_variables (shell_environment);
  477.     initialize_filename_hashing ();
  478.     initialize_jobs ();
  479.   }
  480. --- 742,747 ----
  481. ***************
  482. *** 919,925 ****
  483.   /* Make a bug report, even to the extent of mailing it.  Hope that it
  484.      gets where it is supposed to go.  If not, maybe the user will send
  485.      it back to me. */
  486. ! #include <readline/history.h>
  487.   /* Number of commands to place in the bug report. */
  488.   #define LAST_INTERESTING_HISTORY_COUNT 6
  489.   
  490. --- 940,946 ----
  491.   /* Make a bug report, even to the extent of mailing it.  Hope that it
  492.      gets where it is supposed to go.  If not, maybe the user will send
  493.      it back to me. */
  494. ! #include "readline/history.h"
  495.   /* Number of commands to place in the bug report. */
  496.   #define LAST_INTERESTING_HISTORY_COUNT 6
  497.   
  498. diff -c orig/variable.c ./variable.c
  499. *** orig/variable.c    Wed Jun  5 19:31:42 1991
  500. --- ./variable.c    Fri Jun  7 13:07:14 1991
  501. ***************
  502. *** 110,118 ****
  503.     set_if_not ("PATH", DEFAULT_PATH_VALUE);
  504.     set_var_auto_export ("PATH");
  505.   
  506.     set_if_not ("TERM", "dumb");
  507.     set_var_auto_export ("TERM");
  508. !     
  509.     set_if_not ("PS1", primary_prompt);
  510.     set_if_not ("PS2", secondary_prompt);
  511.     set_if_not ("IFS", " \t\n");
  512. --- 110,122 ----
  513.     set_if_not ("PATH", DEFAULT_PATH_VALUE);
  514.     set_var_auto_export ("PATH");
  515.   
  516. + #ifdef MiNT
  517. +   set_if_not ("TERM", "vt52");
  518. + #else
  519.     set_if_not ("TERM", "dumb");
  520. + #endif
  521.     set_var_auto_export ("TERM");
  522.     set_if_not ("PS1", primary_prompt);
  523.     set_if_not ("PS2", secondary_prompt);
  524.     set_if_not ("IFS", " \t\n");
  525. ***************
  526. *** 231,237 ****
  527. --- 235,245 ----
  528.        do if the variable had just been set. */
  529.     {
  530.       char *tilde_expand ();
  531. + #ifdef MiNT
  532. +     char *tem = tilde_expand("~/bash_his");
  533. + #else
  534.       char *tem = tilde_expand ("~/.bash_history");
  535. + #endif
  536.   
  537.       set_if_not ("HISTFILE", tem);
  538.       free (tem);
  539. ***************
  540. *** 438,444 ****
  541.   {
  542.     SHELL_VAR *entry = find_variable (name);
  543.   
  544. !   
  545.     if (!entry)
  546.       {
  547.         /* Make a new entry for this variable.  Then do the binding. */
  548. --- 446,452 ----
  549.   {
  550.     SHELL_VAR *entry = find_variable (name);
  551.   
  552.     if (!entry)
  553.       {
  554.         /* Make a new entry for this variable.  Then do the binding. */
  555. diff -c orig/version.h ./version.h
  556. *** orig/version.h    Wed Jun  5 19:40:08 1991
  557. --- ./version.h    Fri Jun  7 19:28:22 1991
  558. ***************
  559. *** 5,8 ****
  560.   #define DISTVERSION "1.05"
  561.   
  562.   /* The last built version of this shell. */
  563. ! #define BUILDVERSION 2
  564. --- 5,8 ----
  565.   #define DISTVERSION "1.05"
  566.   
  567.   /* The last built version of this shell. */
  568. ! #define BUILDVERSION 1
  569.